﻿using lyAdminCode.t4;
using Microsoft.VisualStudio.TextTemplating;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace lyAdminCode
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string path = "D:\\temp\\new\\lyAdminCode\\lyAdminCode";
            CustomCmdLineHost host = new CustomCmdLineHost();
            host.TemplateFileValue = path+"\\entity\\"; 
             
            //实体
            entity entity = new entity();
            entity.Host = host;
            string str = entity.TransformText();

            entityContext entityContext = new entityContext();
            entityContext.Host = host;
            str = entityContext.TransformText();


            entityEnum entityEnum = new entityEnum();
            host.TemplateFileValue = path+"\\entity\\Enum\\";
            entityEnum.Host = host;
            str = entityEnum.TransformText();

            entityStateEnum entityStateEnum = new entityStateEnum();
            host.TemplateFileValue = path+"\\entity\\Enum\\";
            entityStateEnum.Host = host;
            str = entityStateEnum.TransformText(); 

             IRepository iRepository = new IRepository();
            host.TemplateFileValue = path+"\\Repository\\IRepository\\";
            iRepository.Host = host;
            str = iRepository.TransformText();

            Repository repository = new Repository();
            host.TemplateFileValue = path+"\\Repository\\";
            repository.Host = host;
            str = repository.TransformText();

            DBEnum dBEnum = new DBEnum(); 
            dBEnum.Host = host;
            str = dBEnum.TransformText();

            IDomain iDomain = new IDomain();
            host.TemplateFileValue = path+"\\Domain\\IDomain\\";
            iDomain.Host = host;
            str = iDomain.TransformText();

            Domain domain = new Domain();
            host.TemplateFileValue = path+"\\Domain\\";
            domain.Host = host;
            str = domain.TransformText();

            Controller controller = new Controller();
            host.TemplateFileValue = path+"\\Controllers\\";
            controller.Host = host;
            str = controller.TransformText();

            ViewTemp viewTemp = new ViewTemp();
            host.TemplateFileValue = path+"\\Views\\";
            viewTemp.Host = host;
            str = viewTemp.TransformText();


            Startup startup = new Startup();
            host.TemplateFileValue = path+"\\Startup\\";
            startup.Host = host;
            str = startup.TransformText();

            Console.WriteLine(str);
        }
    }
}
